<template>
  <header class="top-control-bar">
    <div class="header-left">
      <LogoTitle :to="logoTo" :title="title"/>
    </div>
    <div class="header-center">
      <slot name="center"></slot>
    </div>
    <div class="header-right">
      <WallpaperToggle />
      <UserMenu />
      <ThemeToggle />
    </div>
  </header>
</template>

<script setup lang="ts">
import UserMenu from './UserMenu.vue'
import ThemeToggle from './ThemeToggle.vue'
import LogoTitle from './LogoTitle.vue'
import WallpaperToggle from './WallpaperToggle.vue'

interface Props {
  title: string
  logoTo?: string
}

withDefaults(defineProps<Props>(), {
  logoTo: '/apps'
})
</script>

<style scoped>
.top-control-bar {
  background: #3C3C3C;
  color: #333;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
  height: 32px;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 32px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 32px;
}

/* 深色模式 */
.dark .top-control-bar {
  background: rgba(var(--color-bg-dark), var(--opacity-main));
  color: var(--text-color);
  border-bottom-color: rgba(var(--color-border-dark), var(--opacity-border-dark));
}

/* 响应式设计 */
@media (max-width: 768px) {
  .top-control-bar {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    height: auto;
  }

  .header-center {
    order: -1;
    width: 100%;
  }

  .header-right {
    gap: 0.5rem;
  }
}
</style>